﻿using MyCode.Project.Domain.Config;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Infrastructure.WebPost;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCode.Project.OutSideService.Implementation
{
    public class DingDingService:IDingDingService
    {
        public DingDingService()
        {
        }

        #region SendMsg(发送信息)
        public void SendMsg(string content)
        {
            var url = SystemConfig.DingDingApiUrl;

            WebUtils webUtils = new WebUtils();

            var jsonObject = new { msgtype = "text", text = new { content = SystemConfig.DingDingTxt+ content } };

            var jsonStr = JsonHelper.ToJson(jsonObject);
            
            var result = webUtils.DoPostJson(url, jsonStr);
        }
        #endregion       
    }
}
